var fs = require('fs')
//1、引入mongoose模块
var mongoose = require('mongoose');

//2、连接MongoDB数据库
mongoose.connect('mongodb://localhost:27017/students');

//3.1、创建架构：表结构   对象{ k:v }  约束
var Schema = mongoose.Schema;
//3.2、实例化架构
var StuSchema = new Schema({
	name: {
		type: String,
		required: true //必须写
	}, // String is shorthand for {type: String}
	zi: {
		type: String,
		required: true //必须写
	},
	age: {
		type: String,
		required: true //必须写
	},
	gender: {
		type: String,
		enim: [0, 1],
		default: 0,
		required: true //必须写
	},
	like: {
		type: String
	}
});
// 导出
module.exports = mongoose.model('Student', StuSchema) 